home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AOL File Library: 4,101 to 4,200
/
aol-file-protocol-4400-4101-to-4200.zip
/
AOLDLs
/
ADV - Message Board Archives
/
Archived Msgs_ NDAs & Tools
/
ADV.NDATOOL.shk
/
ADV.NDATOOL.LOG
Wrap
Text File
|
1992-09-13
|
66KB
|
1,830 lines
=======================================================================
Archived Messages: "NDA's and Tools"
America Online Apple II Developers Forum.
Go Keyword ADV!
(C) 1992.
===================================================================jrm=
Discussion of anything unique about using the ToolKit in a New Desk Accessory.
Type: Response
From: KatherineL
Date: 88-02-01 07:55:37 EST
88-02-01 07:55:37 EST
CC: KatherineL
Re: Re: NDA's and Tools
If you are writing an NDA that requires the Stand File tool is it necessary to
call the Tool Locator startup routine or the Miscellaneous Tools startup
routine? I am assuming that one has to call Memory Manager to get the memory
id to allocate space for the Std File tool. If you want to use a window with
zoom and scroll bar is it necessary to call the Desk Manager? Or can you
assume its presence already?
Type: Response
From: SYSOP jim
Date: 88-02-01 23:37:54 EST
Re: Re: NDA's and Tools
Kathy,
For an application to support NDAs, it has to make sure that these tools are
loaded and initialized: Tool Locator, Memory Manager, QuickDraw II, Event
Manager, Window Manager, Menu Manager, Control Manager, Scrap Manager, Line
Edit and Dialog Manager. This means your NDA can depend on these tools being
ready to go. You can make a status call to any other toolboxes your NDA needs
to see if they're available.
Type: Response
From: KatherineL
Date: 88-02-02 23:19:12 EST
88-02-02 23:19:12 EST
CC: KatherineL
Re: Re: NDA's and Tools
What effect would it have to StartUp a tool in a desk accessory that is already
active?
Type: Response
From: SYSOP jim
Date: 88-02-03 00:38:59 EST
Re: Re: NDA's and Tools
I don't know what that might do, Kathy - I haven't tried it. I may be wrong,
but it seems to me that you should make the status call to see if the tool is
active during the initialization subroutine and start the tool if it's
inactive. When DeskShutDown is called at the end of the program, the NDA should
shut down any tools it started.
Type: Response
From: KatherineL
Date: 88-02-13 18:03:26 EST
88-02-13 18:03:26 EST
CC: KatherineL
Re: Re: NDA's and Tools
I tried what you suggested and it helped a lot. I've now moved on to bigger
and better bugs in my code! :) This program would progress faster if I
didn't spend so much time on here! :)
Type: Response
From: KatherineL
Date: 88-02-20 18:33:55 EST
88-02-20 18:33:55 EST
CC: KatherineL
Re: Re: NDA's and Tools
By the way, is there a maximum allowable size for a NDA aside from the limits
of the machine itself? (ie Can't put a 512K NDA in the memory of a 256K
machine).
Type: Response
From: TimH66
Date: 88-03-31 00:32:44 EST
88-03-31 00:32:44 EST
CC: KatherineL
Re: Re: NDA's and Tools
Katherine,
Actually you can put a 512K program on a 256K machine. If you use the segment
loader correctly, the GS Loader will load the needed segments in as it needs
them. As for a DA, I don't know. I think the limit is 64K (1 bank), but I
really don't know. I'll try to find out for you though.
- Tim
Type: Response
From: User797
Date: 88-04-02 23:46:52 EST
88-04-02 23:46:52 EST
CC: KatherineL
Re: Re: NDA memory limitations
Hey -- if Mac users can use a desk accessory to browse a HyperCard stack, we
can do whatever we want! :) /;+/
Type: Response
From: Dave Lyons
Date: 88-07-02 06:09:47 EST
Re: NDAs and dynamic segments
Actually, NDAs can use dynamic segments, too (not just programs). CDAs can NOT
use dynamic segments, since the Loader (which takes care of loading the
segments when they are called) is not available under ProDOS 8. The system
will crash violently if you try to use a CDA with dynamic segments (unless it
checks for the presence of P16 at runtime before making ANY calls to dynamic
segments!).
Type: Response
From: Dave Lyons
Date: 88-07-02 06:11:19 EST
Re: Re: NDA's and Tools
To add to what Jim said (months ago, before I was here!):
An NDA can make Status calls on toolsets that are not required to be started up
(ex: Standard File); if they aren't, it can call LoadOneTool for them, allocate
direct-page space (bank 0, page-aligned), and start up the toolsets. When
DeskShutDown is called (and therefore the NDA's Init procedure is called with a
0 parameter), the NDA should *carefully* reverse anything it did that still
needs to be done: specifically, it should shut down any toolsets it started IF
they are still active [allow for other NDAs not being as polite as we are!],
and it should unload any toolsets it loaded.
When doing a STATUS call from a high-level language (Pascal or C), be SURE to
check for a tool error (TML = ToolErrorNum, C=_toolErr), because the result of
a Status call on a toolset that is not loaded is UNDEFINED--you'll get back
whatever dummy value the compiler pushed onto the stack, which is usually just
garbage left over in a CPU register. If you get a nonzero tool error as the
result of a status call, then the toolset is not loaded in.
Hey! Let's be *careful* out there! [I saw one NDA that *unconditionally*
started up Standard File even if it was already started, allocated a direct
page for it--and then when the NDA was closed, it DEALLOCATED the direct page
but LEFT StdFile started up, just waiting for some poor applicatior other DA to
crash everything....]
Type: Response
From: Dave Lyons
Date: 88-07-02 06:37:04 EST
Re: TLStartUp/ShutDown for Apps only
Forgot to say this in my last message: It's extrememly necessary that ONLY
applications call TLStartUp and TLShutDown. If a desk accessory or something
makes those calls, the less fortunate parts of the system that are still trying
to make toolbox calls [like the application you're running] will find that some
of the tools aren't in memory anymore! The system will crash in short order....
Type: Response
From: Dave Lyons
Date: 88-07-05 01:19:51 EST
Re: NDAs and the Cursor
Has anybody seen/written an NDA that changes the cursor to something other than
an arrow when the mouse is over its window? I may have to try it, because I'm
not sure all of my applications behave correctly...they may try to change the
cursor back to something else while an NDA is the front window.
Type: Response
From: Dave Lyons
Date: 88-07-05 01:21:55 EST
Re: NDAs and Menus
Has anybody seen/written an NDA which installs its own menu in the system menu
bar? Parts of the toolbox documentation seem to imply this is possible, but I
don't know exactly how. There's a "DAMenu" event defined for NDAs to receive,
but how do you go about installing the menu so that the system knows to feed
the menu selections to the NDA? (Last time I checked, it did NOT seem to be
sending *all* menu selections through the front NDA.)
Type: Response
From: AFL Floyd
Date: 88-07-05 14:25:27 EST
Re: Re: NDA's and Tools
Dave,
In regards to the cursor switching in an NDA, you would branch to your cursor
routine in your action table when you get an action code of #3 (for cursor).
You would only get this action code when the NDA window is the front window.
Your cursor routine would save the port, make your NDA window the active port,
and then check the mouse position. If it is within your content region then
you would switch the cursor. If it is NOT within the content region you would
switch to the application cursor.
A good example of this is in Gary Little's book "Exploring the Apple IIgs".
Floyd
Type: Response
From: Dave Lyons
Date: 88-07-05 18:27:43 EST
Re: NDAs and Cursors
Sounds good, but how does the NDA know what is the "Application cursor"? I
suppose it can just call GetCursorAddr when it is opened (or is there a better
way or better time)?
The other question is what the application has to do--I guess it should never
do a SetCursor while an NDA is in front, although it needs to, for example,
change it from an I-Beam to an Arrow when an NDA is opened. I don't see how to
do this cleanly while still letting TaskMaster take care of opening NDAs
automatically.
How about if the appl watches FrontWindow and sets the cursor to an Arrow
*once* when the front window changes from a application window to a system
window? (That should be fine except maybe for NDAs that set the cursor only
when they think it isn't already set...ugh.)
Type: Response
From: AFL Floyd
Date: 88-07-05 19:22:18 EST
Re: Re: NDA's and Tools
Dave,
Yes. Use GetCursorAdr in your NDA_Open routine and save it. You should change
the cursor IN the NDA, not the application. The cursor action routine is
automatically called by taskmaster when your NDA is the front window. When
your NDA closes it should restore the cursor to the one that was saved when it
opened.
I have some source code from Gary Little that demonstrates this cursor stuff.
Let me know if you want it.
Floyd
Type: Response
From: A2Pro Tim
Date: 88-07-05 23:05:12 EST
Re: Re: NDA's and Menus...
Dave,
I'm currently working on an example NDA that will have a menu bar in its
info bar. It will (hopefully) be published as a "here's how you do it' article
later this year....
There is a RECENT tech note that shows how to do it from APW C. I plan on
doing it from ORCA/Pascal...
Tim S.
Type: Response
From: Dave Lyons
Date: 88-07-06 01:00:19 EST
Re: Menu bars in NDAs
Tim, I actually managed to put a Menu bar in an NDA's info bar (from TML
Pascal). I haven't yet modified it based on the revised Info Bar technote.
I still wonder whether there's a supported way for NDAs to use the system menu
bar, though.
Type: Response
From: Mensch72
Date: 88-07-07 00:32:37 EST
Re: Re: NDA's and menus
Dave,
in fact, No, sorry. NDA's can't put up their own menus in the system menu bar,
since all applications accept all menu actions for themselves ( in fact you
could end up crashing most applications by putting up another menu and
selecting from it!). The best way to do it is, just what you have been doing,
place a menu bar in the windows infobar.
Jim
(If you want to check how I arrived at the no, simply examine how taskmaster
works and ask yourself, when would it ever pass a menu event to a DA since it
never knows who the menu event belongs to... something the task master author
never thought of obviously...)
Type: Response
From: Nuzz
Date: 88-07-08 23:38:56 EST
Re: Re: NDA's and Tools
I assume the tech note you're all talking about is IIGS Note #3 "Window Bar
use". dated 5/88
I'm trying to follow the code in the note about putting a menubar in the info
bar. A few questions:
1. They use a routine to "set size of menu"
Couldn't I use _calcmenusize instead?
2.Another routine they use is"Set flag to tell Menu Mgr to draw menu in current
port"
I thought the menu manager always draws in the current port?
Mike
Type: Response
From: Dave Lyons
Date: 88-07-10 00:59:03 EST
Re: Menus in Info bars
Mike, I think the Menu Manager draws in its own port normally--the one you can
get with GetMenuMgrPort.
CalcMenuSize calculates the size of an individual menu, but it doesn't do
anything about the menu bar rectangle itself. FixMenuBar comes a bit closer,
calculating a "standard" rectangle for the menu bar & calling CalcMenuSize on
each menu.
By the way, I noticed that there are TWO places where the revised technote #3
talks about telling the menu manager to "draw in the current port": It passes
$FFFFFFFF to NewMenuBar, and it also sets the highest bit of the CtlOwner field
of the menu bar record. Seems redundant to me, and I can't find either of
these in the toolbox ref.
Also by the way: Can someone tell my how giving -1 to NewMenuBar is different
from giving it a pointer to your NDA's window? And assuming it's different,
when is it useful to pass a window pointer to NewMenuBar? (The toolbox
reference describes the parameter as "POINTER to window's port; NIL for system."
Type: Response
From: Matt DTS
Date: 88-07-10 12:47:08 EST
Re: Re: NDA's and Tool Startups
Jumping back a topic or two:
There is MUCH more to the issue of loading and starting up tools which are not
already available than carefully reversing steps at the end of the application.
Take this scenario, for example:
An NDA wants to use the List Manager, and finds it's not currently active. It
loads the tool, allocates the space necessary for it (not sure on what it is -
my manuals are at work) and starts it up. While the NDA is displaying the NDA
window with the list in it, the user clicks back on the application window, and
the application then decides to use the List Manager, which it had previously
not loaded or started up to save memory. Uh-oh! The List Manager is already
started up!
Another scenario: NDA finds the List Manager available, and while displaying
the NDA window with the list in it, the user clicks on the Application window
and closes it, which shuts down and unloads the List Manager (since the
application started it up). Uh-oh! What happens when the NDA makes a List
Manager call and isn't prepared to clean up the stack when it gets "tool not
found"?
NDA's like those that use Standard File to load a file for viewing are
reasonably safe. They do SFStatus, LoadOneTool /SFStartUp (if necessary),
SFGetFile (which is a modal dialog), load the file, then
SFShutDown/UnloadOneTool (if necessary). There's very little chance that the
user could take control away from the NDA before the toolset tht was started up
is properly disposed of. But for things like the List Manager example given
above, I can't help but recommend that NDA's *NOT* load or startup, or use
tools which are started up that aren't guaranteed to be available to NDAs,
UNLESS the NDA can be reasonably sure that the application won't change the
status of the tool underneath the NDA.
The application has the reasonable right to assume that it can start up and
shut down tools it only needs occasionally (like Standard File and the Print
Manager) as it pleases, and shouldn't have to worry about crashing the system
if an NDA has done something unexpected with the tool. Similarly, the NDA
shouldn't crash the system if it uses a tool the application opened, and
suddenly the tool isn't there anymore.
And NDAs should ALWAYS be prepared to deal with LoadOneTool failures for extra
toolsets, instead of crashing the system with a "fatal error" (I've seen this
happen once).
(I have every confidence in the world that Mensch will correct me if I have
said anything even slightly incorrect.)
--Matt
Type: Response
From: Dave Lyons
Date: 88-07-10 17:29:47 EST
Re: Re: NDA's and Tools
Matt, I agree with a lot of that--especially about NDAs being careful not to
crash the system, never causing fatal errors, etc.
But I do think NDAs have the right to use any toolsets they need to, and that
guidelines to make this work smoothly should be clafified if that's what we
need. Seems like one thing that hasn't been discussed enough is what
Applications should do about starting up/shutting down tools in
mid-application. For example, it seems like applications should be as polite
as NDAs should be: when starting a toolset that an NDA may have started, check
first & don't start it up again; don't shut down a toolset in mid-application
if an NDA may be using it. Seems straightforward enough to me, but I don't
know how many applications do this sort of thing--other than Standard File
stuff, I don't know of any applications that start toolsets in mid-application.
I don't understand the example of quitting an application causing toolsets to
shut down while NDAs remain active. NDAs don't survive between applications,
and the application is required to call DeskShutDown (which gives all NDAs a
chance to clean up after themselves) BEFORE shutting down other tools--the ones
required for NDAs, at least. Even if the application is impolite enough to
shut down tools that NDAs may be using before doing DeskShutDown, the NDAs
should be polite enough to notice this & not try to shut them down again.
Now, if we had a MultiFinder I guess things would be a lot different--if
somebody wants to invent guidelines on tool use to stay compatible with
environments like this, I'm listening! (And I DON'T mean guidelines like "NDAs
shouldn't load any extra tools"! That wouldn't be any fun at all!)
Type: Response
From: Parik Rao
Date: 88-07-10 19:28:01 EST
Re: Re: NDA's and Tools
Heres a great guideline...
Tools are ALWAYS active! YEAH! Heh, that'd be great. You don't have to worry
about...
"Oh hell, did I already call that sucker? Better go id it. Yep, sure did. Oh
no, its been purged! Ahhhgghhh!"
Or stuff like that. Instead, of at ProDOS 16 boot, all tools were initialized
and ready to go (eg, all a user has to do is call tools and not _QDstartup or
whatnot), that way tools are ALWYAS active, NEVER shutdown. This could happen
on a cold-boot also. Be nice in newer versions of the Apple IIgs.
{although I admit tons of memory would be needed...}
Type: Response
From: Nuzz
Date: 88-07-10 21:54:23 EST
Re: Re: NDA's and Tools
Dave
I think if you pass -1 to newmenubar, then it would draw to the front window.
The example in the tech note sets up the menu BEFORE the window is displayed.
I couldn't find any reference to $FFFFFFFF in newmenubar either. I also
couldn't find CtlOwner or CtlRect. They are probably there somewhere and I'm
missing it.
While on menus and Nda's, how can I disable the system menu when an Nda window
is displayed?
Type: Response
From: JimMensch
Date: 88-07-11 01:51:38 EST
Re: Re: NDA's and Tools
Since the system menu does not "belong" to you ( I hate to say this it sounds
so authoritarian...) You have no business whatsoever making any changes at all
to it! In fact, any messing you do would be considered a very large nono by the
menu manager and if it caught you, it would probably crash or something!
With that said, to disable the system menu bar, simply create a new menu bar
with nothing in it and call setsysbar and setmenubar this will cause your empty
bar to superceed the old sysbar ( rmember to save th old one first so you can
restore it!) the unfortunate side effect will be that the app's menu bar will
be erased... ( you can redraw it by calling setsysbar and setmenubar with the
original sysbar handle ).
NOW, as for starting up tools in a DA. We at Apple think thats a really bad
idea! However, their exist those cases when it has to be done, and there are
some guidelines you can follow for your programming pleasure:
1. Always try to avoid using any tools that are not started
by the application! ALWAYS!
2. When step one appears to be impossible, use loadonetool to load
the tool you want and start it up. First checking to
be sure that you have all the other tools that it needs
started up.
3. ALWAYS shut down any tool you started up! I suggest doing
this when you are done with it, or at DA Close time.
4. If you are using tools that an Application has started up
Simply ( and blissfully ) use them to your hearts content
having faith that the application will not shut them down
behind your back. ( I would consider that an application
bug, after all it is the one causing you the trouble.
Always remember to blame the other guy!)
And if that were not enough, I am now going to yell at each and every one of
you for the BONEHEADED thing some unknown author did to my application with his
stupid DA! To do this I am going to present you with what I consider to be the
most important rule of all in DA's!
RULE: Never, ever, ever, when calling a tool, do anything that will cause the
state of the tool you are calling to change as far as the application is
conscerned! The reason I say this is that many of the tools have one place to
store state information, like SANE has a rounding setting, and the Note Synth
has a refresh rate, and the menu manager has the sysbar variable! If you need
to change a global value like the ones above please be sure to restore them to
the way you found them on exit of all your DA routines.
Well, I think that covers what I wanted to say...
Jim
Type: Response
From: A2Pro Tim
Date: 88-07-11 03:02:50 EST
Re: NDA's CAN add t the SysMenu bar!
I hate to argue with the folks at DTS (in particular Jim Mensch), butttttttt I
know of at least one NDA that _DOES_ add a menu to the system menu bar!!! It's
called Two Apples and allows the user to access about double the usual number
of NDA's by adding a second Apple menu.
Obviously, the _ONLY_ reason that this type of menu CAN be added to the
System's Menu bar by an NDA is because Task Master launches the NDA's for you
when they are selecteed from the second menu. Guess it's just one of those
"special cases"...
Tim S.
Type: Response
From: Nuzz
Date: 88-07-11 18:29:06 EST
Re: Re: NDA's and Tools
I never thought getting yelled at would be educational, but once again, I
learned something from our friend at the COMPANY.
Gee Jim, you should put that "WE at Apple frown........" into a macro, end it
in but, then go on to how it's really done.
All funning aside, thanks for the help.
ps
Even though you still haven't sent me the Ray Russell information yet.
Mike
Type: Response
From: Dave Lyons
Date: 88-07-11 22:44:00 EST
Re: Re: NDA's and Tools
Jim M, I have a couple of medium-sized problems with some of the stuff a few
messages back. I agree with you, except for the things I'm about to whine
about here.
First, I respectfully suggest, request, and hope that "you at Apple" will stop
thinking that starting tools from NDAs is a bad idea and, instead, solidify
some rules that will make it a Good, safe idea. People *do* need/want to do
it, and it's easy to do wrong.
Number 3 in your list was that an NDA should always shut down any tools it
started up, and that it should start up any tools it has to use that were not
already started by the application. I agree. But I don't agree about WHEN the
NDA should shut down a tool it started up. Consider that an NDA has *no way*
to determine whether a tool was started by the application or by ANOTHER NDA!
If TWO different NDAs follow your rules w.r.t. the same non-required toolset,
then they will end up violating your rule 4 on each other: assume that toolsets
are not shut down behind your back. Let A and B be NDAs, both of which need
the Font Manager. A is opened & sees that the application has not started the
FM; it loads and starts it. B is opened and finds the FM already available &
assumes it will stay available. A is CLOSED and (by your rule) shuts down the
FM. B is still open and will probably crash the system when it tries to call
the FM.
For this reason, I suggest that NDAs should reverse their tool
startup/load-on-tool actions *not* when they are closed but when they get a
DAInit call with code 0, meaning that DeskShutDown was called by the
application.
Of course, for a toolset (like Std File) that can be started, used, and shut
down, it's safe shut it down as soon as the NDA is finished with it, as long as
it's NOT left open for another NDA to notice.
I have used this approach in my "Show Clipboard" NDA (available on CI$ and
GEnie currently, but without source), so if it is going to cause a problem I
want to know about it. The toolsets in question there are Scrap Manager, Font
Manager, and QD Aux. It never crashes the system, even if the toolsets are not
available. FM and QD Aux are needed for displaying PICT info on the clipboard.
If they aren't available, then it only tries to display TEXT. I will be glad
to upload the TML Pascal source here if you (anyone) are interested.
--Dave Lyons
Type: Response
From: JimMensch
Date: 88-07-12 20:28:59 EST
Re: Re: NDA's and Tools
Dave,
Not a bad idea for shuting down the tools in an NDA. I will give it a bit of
though.
About the extra Apple menu, the only reason that works is because taskmaster
automatically handles all menu items between 1 and 255 in a special way, so yes
Adding another DA menu would work because its Item ID's would have to be below
250 to be DA's. But, I suspect that is not what is desired when most people
want a DA to add a menu. The DA would have no problem adding any menus ( I
never said they would...) Its having your DA called when the menu choice is
made that is the problem. with items below 250 taskmaster automatically makes
an Open call to the proper DA, with any other menu items, it simply passes them
to the application.
As an asside, Dave, I agree that their should be guidelines for DA's starting
up tools that cover all situations, unfortunately, those rules are going to be
a little difficult to define. I will however present you with a problem that I
heard today. I was told by a guy who wrote a DA that uses the Note Synth that
he has found 2 or 3 apps that like to start the note synth and shut it down,
during the app (not once but several times) This causes him a bit of trouble,
and unfortunately, it is the right of the App programmer (although I wish we
had never given him that right...).
Anyway, thats all for now
Jim
Type: Response
From: A2Pro Tim
Date: 88-07-13 00:33:29 EST
Re: Re: NDA's and Tools
Jim,
I agree with your statement that MOST folks want to add menus from NDA's
that do MORE than just access additional NDA's (like Two Apples NDA does). I
_ONLY_ brought it up to show that it IS possible (jst VERY limited)... :)
I for one would GREATLY apreciate it if DTS would define a 'standard' for
NDA's that need additional tool sets... (hint, hint)
Tim S.
Type: Response
From: Dave Lyons
Date: 88-07-17 05:26:28 EST
Re: Re: NDA's and Tools
Jim M--Back on 7/11 you mentioned that an NDA can call SetSysBar and SetMenuBar
to replace the application's menu bar with its own (and restore the old one
later). If I understand you correctly, I'm confused.
How will the NDA receive menu events from that menu? The only thing I can
think of is that TaskMaster will behave as if a MouseDown occured in the NDA's
window & let the NDA call MenuSelect, etc. This doesn't seem quite right,
though, since I don't see how it could work with applications that don't use
TaskMaster.
Also, if an NDA does replace the application's menu with its own, is it
possible to have an Apple menu in the NDA's bar? (Setting it up should be no
problem...just call FixAppleMenu(...), but can the NDA open a new NDA without
confusing the application? Non-TaskMaster applications could try to keep track
of the RefNums of open NDAs, right?)
--Dave "endless questions" Lyons
Type: Response
From: AFL Jim
Date: 88-07-17 10:19:23 EST
Re: Re: NDA's and Tools
Oh No! Recursive Apple Menus...
Type: Response
From: JimMensch
Date: 88-07-19 02:53:50 EST
Re: Re: NDA's and Tools
Dave,
what I said in the previous message was, that an NDA certainly could change the
system menu bar. However, if you continue reading the transactions, I also
stated that it would be a silly Idea for the most part since the DA couldn't do
anything with it anyway! As for changing the sysbar, certainly put an Apple
menu in your alternate sysbar, thats not only legal, its considered good
programming (the system menu bar should always have an Apple menu, a file menu
and a quit menu in a well behaved/desktop program). I will upload a two sysbar
menu sample program as soon as they sort out the libraries here, It is a
program that shows how to swap sysbars. (I am also working on a way for DA's to
be able to add menu items... but don't tell anyone! he he he)
Jim
Type: Response
From: Nuzz
Date: 88-08-01 20:11:14 EST
Re: Re: NDA windows
Does anyone know of a recommended way for an NDA window to copy the content and
vis region of the active port upon an nda open call. I've tried _frontwindow
then _getcontentdraw, _setcontentdraw, without much success.
Mike
Type: Response
From: Dave Lyons
Date: 88-08-02 00:24:38 EST
Re: getting Vis region?
I don't understand what you're trying to do, Nuzz. Your NDA wants to know
about its OWN window, or about the previously-current port?
Anywa, GetContentDraw is going to give you a pointer to the routine that is
called to update the window. Very different from what you'll get with
GetVisRgnHandle or whatever.
Type: Response
From: Nuzz
Date: 88-08-02 22:25:33 EST
Re: Re: NDA's and Tools
Dave
What I want to do is copy the contents of the previously current window into my
Nda window. I was trying to get the portloc info on the current window before I
changed ports, then set my da content draw to the previous content draw, but I
guess this is not the way to do it.
Mike
Type: Response
From: Dave Lyons
Date: 88-08-02 22:37:02 EST
Re: stealing old window's contents
Mmmm...Okay, at least I see what you're trying to do now. I'm not sure there's
a way to do what you want.
You can find the previously-front window (and therefore its port, since the
port is the first thing in the window record) by feeding YOUR window pointer
into GetNextWindow ("next" = the next one in front-to-back order, so it will be
the one right "behind" yours--"behind" sounds funny if the windows don't
overlap, but it's still what you want).
You will have to capture the image BEFORE you open your NDA window if you want
a good chance of salvaging something useful from the old window. There is *no*
guarantee that there will be anything there, although there *usually* will be,
and you should be able to grab it with CopyPixels or whatever. Of course,
you'll need to calculate the amount of memory needed and allocate it with
NewHandle.
Why do I say there may not be anything in the window for you to capture?
Because mouse event have priority over update events. If something just
happened to make the window visible and the user chooses your desk accessory
right away, the window may be partly or completely blank.
This may not be a big problem. If you want, you could probably use CheckUpdate
to find out if the front window needs updating (or you could use GetUpdateRgn
on it and see if the region is empty--maybe that would be better). If the
window DOES need updating, you could go ahead and have your NDA open a *tiny*
window behind the menu bar, so as not to obscure the window you're interested
in. (Of course, watch out for that window suddenly becoming the
SECOND-to-front window when you open yours, unless you specify the "behind
pointer" appropriately in your NDA's window.)
I hope this gets your started. Good luck!
Type: Response
From: Nuzz
Date: 88-08-05 23:18:22 EST
Re: Re: NDA's and Tools
Thanks for the help Dave. I've done almost what you suggested. I opened a one
pixel window behind the menu bar, and set my port to the menumgrport ( I have
to draw a rectangle on the screen) The menumgrport works fine because it is
always (on screen) when the Nda is called. Now, all I have to figure out is how
to save the pixels in the rectangle. CopyPixels should do it.
Thanks
Mike
Type: Response
From: AFL Jim
Date: 88-09-25 16:28:48 EST
Re: NDAs and special menu items
Dave Lyons has noticed the trend of publishers to NOT support the scrap
manager. This means you can't CUT or COPY text or graphics from an application
onto the clipboard, quit, run another application and then PASTE that text or
graphics into the second application. I've noticed a similar problem.
Most applications DON'T support passing the special menu items on to NDAs. The
special menu items are Undo, Cut, Copy, Paste, Clear, and Close. What this
means is those applications won't let you use desk accessories that depend on
those menu items being passed to them. Programs that use TaskMaster and define
those items with the correct menu item numbers should work OK - most either
aren't using TaskMaster or aren't using the menu item ID numbers assigned for
those special items. The ID numbers used should be:
Hex Decimal Description
----- ------- -----------
$00FA 250 Reserved for Undo edit item
$00FB 251 Reserved for Cut edit item
$00FC 252 Reserved for Copy edit item
$00FD 253 Reserved for Paste edit item
$00FE 254 Reserved for Clear edit item
$00FF 255 Reserved for Close command item
See page 13-16 in the "Apple IIGS Toolbox Reference" for the menu ID number
assignment information. Gary Little's book, "Exploring the Apple IIGS", also
give correct information in the Using Pull-down Menus chapter.
Type: Response
From: Dave Lyons
Date: 88-09-25 22:44:07 EST
Re: NDAs & Scrap Manager
If an application passes key-down events correctly to NDAs, you can still use
undo/cut/copy/paste/clear if the NDA supports Apple-Z, -X, -C, -V, and the
Clear and Delete keys. (This covers the case where TaskMaster is used but the
application uses its own menu item numbers for the Edit stuff and fails to call
SystemEdit with the appropriate code when one of them is chosen. The
application can tell that the front window is an NDA by calling GetSysWFlag on
the FrontWindow when FrontWindow returns something non-nil. [Pitfall: Don't
call GetSysWFlag (FrontWindow) if FrontWindow could be nil--GetSysWFlag can
return TRUE in that case and lead to a crash if you go ahead and do things that
assume the front window is an NDA!])
Type: Response
From: TMH2
Date: 88-12-17 00:09:58 EST
Re: Re: NDA's and WindowManager
(This should perhaps be under Window Manager, but here goes).
I feel stupid for asking this, because it seems so simple. I have an
application which uses TaskMaster and which has a modeless dialog, so it is
using IsDialogEvent/DialogSelect (just FYI). It works perfectly, except for
with the MEMORY NDA, which APPEARS to use a modeless dialog (maybe it's just a
window, though). If that NDA is open, and is the active window, key
equivalents for menu selections do not work. The File menu, for example, does
not flicker when I use the Close equiv. key. As I said, everything else,
including my modeless dialog, work fine; in addition, my dialog doesn't even
have to be open for this error to appear. Is this my code's fault, or the
NDAs? or TaskMaster? or whose???
Z^\GGGGGGGGGGGGGGGGGGG\_
Z R
Z T. Mike Howeth II N
Z Dallas, Texas N
Z (TMH2) V
Z B Q
ZO WVWVWVWVWVWVWVWVP_
Type: Response
From: Dave Lyons
Date: 88-12-17 01:21:10 EST
Re: NDAs and Apple-keypresses
Everything's working just how it's supposed to, TMH: key equivalents do _not_
work while a NDA window is in front; instead the key-down events get passed to
the NDA, which may or may not do anything with them. (I think the only
exceptions are Apple-Z, X, C, V for Undo, Cut, Copy, Paste, _if_ the Edit menu
items are numbered 250-254 like they should be. In that case, the NDA receives
an Edit event through SystemEdit instead.)
By the way, there's no way to tell the difference between a window and a
modeless dialog by looking at them, but as far as I know all NDA windows need
to be plain windows and not modeless dialogs.
--Dave
Type: Response
From: AFL Jim
Date: 88-12-17 21:25:45 EST
Re: NDAs and Standard Edit Items
Dave's right (again). From tests I've done, I've found that many applications
don't use the standard item numbers for undo (250), cut (251), copy (252),
paste (253), clear (254), and close (255) or don't handle NDAs correctly in
other ways. By using the standard item numbers, NDAs such as mini-editors,
scrapbooks, clipboard viewers will be able to use the pull-down menus for edit
commands with applications using TaskMaster. Also, applications should enable
these menu items when the top window is a system window (NDA window).
If you're writing an application that doesn't use TaskMaster, you still should
carefully read the TaskMaster section in the Apple IIGS Toolbox Reference
(pages 25-118 to 25-126). Included is pseudocode that shows how TaskMaster
handles events. This might remind you of some things your application should be
doing when it handles events.
Jim L
Type: Response
From: TMH2
Date: 88-12-18 01:55:22 EST
Re: Re: NDA's and Tools
Thank you both. As for correct item numbers, I was very careful when creating
my desktop-environment source-code template that I adhered to the standards on
these sorts of points.
I'm glad to know that the key equivs aren't supposed to work w/ an NDA open,
'cos I sure couldn't find any problem with my code in that area! Thanks again.
Z^\GGGGGGGGGGGGGGGGGGG\_
Z R
Z T. Mike Howeth II N
Z Dallas, Texas N
Z (TMH2) V
Z B Q
ZO WVWVWVWVWVWVWVWVP_
Type: Response
From: AFL Jim
Date: 88-12-18 20:33:43 EST
Re: Edit Menu Keyboard Equivalents
The key equivalents *will* work on the 5 edit menu items listed if your
application uses TaskMaster (or acts the same) and if your NDA handles
SystemEdit calls.
Jim
Type: Response
From: TMH2
Date: 88-12-20 00:22:58 EST
Re: Re: NDA's and Tools
SO the bottom line in the situation I described above is that the NDA is not
calling SystemEdit so that the key equiv can be passed up the line to my
application, right?
Z^\GGGGGGGGGGGGGGGGGGG\_
Z R
Z T. Mike Howeth II N
Z Dallas, Texas N
Z (TMH2) V
Z B Q
ZO WVWVWVWVWVWVWVWVP_
Type: Response
From: AFL Jim
Date: 88-12-20 18:24:15 EST
Re: NDAs, Edit menu and TaskMaster
Mike,
When a NDA is active, the only reasons I can think of an application using
TaskMaster wouldn't call SystemEdit for the undo, cut, copy, paste and clear
menu items or wouldn't call CloseNDAbyWinPtr when the close menu item is
selected are:
o The standard menu item numbers for undo..close (250..255) were not used.
o Taskmaster TaskMask bit tmSpecial (bit 12) is 0.
The NDA might not accept the SystemEdit call. In that case, the NDA will
(should) return FALSE to the SystemEdit call and TaskMaster will return
wInSpecial to your application with the low word of wmTaskData holding the ID
of the selected menu item and the high word of wmTaskData holding the ID of the
selected menu.
Jim Luther
Type: Response
From: Dave Lyons
Date: 88-12-21 04:59:46 EST
Re: what SystemEdit does
Right...what Jim said. SystemEdit gets called by an application directly, or
indirectly by TaskMaster when the application calls TaskMaster. It's
responsible for feeding Edit events _to_ NDAs when they occur. Nothing
originates in an NDA and works its way back up to the application (makes sense:
applications have main event loops that dispatch things where they should go;
NDAs get called and return as soon as they can).
--Dave
Type: Response
From: AFL Jim
Date: 89-01-16 18:01:21 EST
Re: New Desk Accessories
(Moved Message)
Subj: New Desk Accessories 89-01-16 01:56:54 est
From: SteveAllen Msgs: 1 (89-01-16)
I am trying to write a new desk acc. using a modeless dialog. The only way I
can get the Dialog Items to respond is by calling TaskMaster withing the NDA
Action loop. The is due to _IsDialogEvent and _SelectDialog both reguiring a
pointer to the Event Record. It seems I should not have to call TaskMaster
inside an NDA. Can you help?
Type: Response
From: Dave Lyons
Date: 89-01-16 21:38:36 EST
Re: NDAs using modeless dialogs
I don't think using modeless dialogs from NDAs is something you're supposed to
be able to do.
You definitely can't assume that the application is using TaskMaster. If you
try to call IsDialogEvent or DialogSelect, you might be able to synthesize an
event record, but it'd be some work.
Probably both safest and simpest to have your NDA be a regular window and do
the FindControl and TrackControl calls yourself.
--Dave Lyons
Type: Response
From: PGauthier
Date: 89-09-14 21:34:49 EST
Re: NDA with no close box
Is it possible to write a NDA that does not have a close box in its window, nor
a title, but instead is "closed" by hitting the "esc" key? I want to use the
entire screen for a picture. All the docs I know of seem to imply that the
only way to tell the system a NDA needs to be closed down is for the user to
click in the close box.
Paul G.
Type: Response
From: AFL Floyd
Date: 89-09-16 17:41:26 EST
Re: NDA with no close box
Paul,
Couldn't you just call CloseNDAbyWinPtr(windowPtr); when you notice the ESC key
being pressed?
Floyd
Type: Response
From: PGauthier
Date: 89-09-16 20:15:26 EST
Re: Re: NDA with no close box
Floyd,
I tried that and nothing happened. The window didn't close.
Paul
Type: Response
From: Dave Lyons
Date: 89-09-19 20:44:13 EST
Re: NDA closing itself?
I'm not sure it's a good idea for an NDA to call CloseNDAByWinPtr on itself
(even if it works).
Note that (starting with System Software 4.0) it's okay for your NDA's Open
routine to do something *modal* and then return NIL for the returned window
pointer--that way, the NDA would never really be open, as far as the Desk
Manager is concerned.
--Dave
Type: Response
From: Sir AWGS
Date: 89-09-27 01:53:00 EST
Re: Re: NDA's w/ No Close Box...
I had no trouble doing this with Calculator - on the DeskWorks package - I used
CloseNDAbyWindowPtr with no trouble.
-Tom
Type: Response
From: Windrider5
Date: 89-10-05 20:43:20 EST
Re: Re: NDA's using APWC
I am intereseted in writing NDAs using APWC. I have read Tim Swihart's
articles describing the procedure for writing NDAs using ORCA/Pascal. My first
question is: Can an NDA be written in APWC using a similar procedure. (the
pascal code seems relatively simple in that it does not seem to have to deal
with perserving and restoring the data bank register ) and if it can be how
might I be able to implement it.
My second question is: if NDAs in C can not be written as in Pascal, do I have
to follow the procedure as described in the APWC manual (pg 3-9) and in the DA
sample code written by G. Ortiz of Apple Computer? If that is the case, it
would appear that I can not write an NDA in APWC without giving credit to Apple
computer. This does not really matter, but it seems like there should be some
alternatives.
Type: Response
From: Coach101
Date: 89-10-21 10:33:15 EST
Re: Credit To Apple....
If you use Apple's sample code, then I guess you would have to mention them in
the credits.
If you look at what they did and do it yourself (not a direct transliteration)
then I do not see why you would have to give them credit. After all, none of
use put up a credit to Ada, Knuth, Dykstra, etc., with our programs and we use
a lot of what those people found and published.
Type: Response
From: Coach101
Date: 89-10-29 15:23:29 EST
Re: NDA Init Entry.......
I have a desk accessory that is behaving as if the INIT function is not always
being entered with the (A) register set to indicate that it is a StartUp (a <>
0) call. I have inserted SysBeep calls in the init function (1 bell for
ShutDown and 2 bells for StartUp).
Does anyone have any suggestions for pursuing this problem. I have tried
inserting BRK instructions at entry (so that GSBug {init incarnation} will get
control) but the K/PC upon entry to GSBug appears invalid (i.e., the code at
K/PC does not contain a BRK and is not anything close to my code).
Also, has anyone else had problems with NDA init functions?
Type: Response
From: Coach101
Date: 90-04-08 21:29:06 EST
Re: Multiple Windows Per NDA
The following messages were moved here from another folder...
-----------------------------------------------------------------
Subj: Multiple Windows in an NDA...?? 89-11-14 02:09:00 EDT
From: Steve S816 Msgs: 4 (89-11-22)
I'm writing an NDA that performs many functions. Some of the functions require
an additional window. While the main window is declared to be a Sys window and
has its pointer passed internally to the Desk Mgr when the NDA is opened, I
can't seem to get the additional window to be recognized as a system window.
The call _SetSysWindow seems to do its job as far as marking it as a Sys
window, but all of the Events that are associated with the second window are
all grabbed by the underlying application and not passed along to me to handle.
I am calling: _NewWindow, _SetSysWindow, _SetPort, _NewControl(s). This second
window has an info bar which gets properly constructed during the NewWindow
call. The code has been thoroughly tested (and works) under 'stand-alone' or
'modal' conditions; that is, with it's own event loop using TaskMaster.
Is it even possible for one modeless NDA to have 2 simultaneous regular
(drag/zoom/infobar/scrollbars) windows? (I already have modal dialogs and
alerts that properly pop up over the main window). If so, what am I missing?
If not, how can I add & remove an info bar to an existing window (to eliminate
the need for the second window)?
Thanks,
Steve Stephenson
-----------------------------------------------------------------
Subj: I Had The Same Question.... 89-11-15 01:29:31 EDT
From: Coach101
After much thought and I decided that there is a decided problem here. One
solution I came up with is to have the "mother" NDA install a new NDA (the
subordinate window you are looking for). Then you could Open the new NDA and
later Close and remove the new NDA. I did not finish researching this but
there was one stumbling block I had not found an answer to; on one of the calls
I needed to use above (install/open/close/remove) I had to specify an NDA
number instead of an NDA name and I did not find a way to move between numbers
and names.
The solution I finally settled on was to open a new window and then "trap" the
user in the window. I would use GetNextOSEvent and if the event was within the
new window I would call TaskMasterDA with the event. If the event was not
within the new window I would ring the bell and go back for another event.
This sort of gets what you want but has drawbacks (you have trapped the user in
a window).
Anyway, all of this belongs further down in the WindowManager folder so..
Would some kind, generous, helpful, forum type move this discussion down to the
Window Manager or NDA folders....
-----------------------------------------------------------------
Subj: one window per NDA 89-11-21 23:07:07 EDT
From: Dave Lyons
The short answer is that an NDA can only have one (modeless) window. You only
get the events for the window that your DAOpen routine returned a pointer to.
I don't know of a way to add and remove an info bar from a window--you may have
to make it *look* like you have an info bar sometimes, by drawing in the
content area.
--Dave
-----------------------------------------------------------------
Subj: thanks 89-11-22 21:46:51 EDT
From: Steve S816
Thanks guys, I've decided to go with a modal dialog (gonna be a whopper of a
filter procedure).
Steve
-----------------------------------------------------------------
Type: Response
From: Coach101
Date: 90-04-08 21:31:47 EST
Re: ScrollBars In NDA Windows
The following messages were moved from another folder
-----------------------------------------------------------------
Subj: NDA Window Scroll bars 89-11-03 22:11:55 EDT
From: WinkieJim Msgs: 5 (90-04-05)
Ok, I'll start this off simple are there any trick to get scroll bars working
on a NDA System window (or ordinary window for that mater). There is nothing
mentioned in the Toolbox refs about having to handle the scroll bars myself. I
would hope that TAskmaster took care of them...if not what needs to be done...
thanks...
Jim
-----------------------------------------------------------------
Subj: TaskMaster Will Do It.... 89-11-04 02:05:56 EDT
From: Coach101
For an NDA that means you need to use TaskMasterDA (see the discussion further
down on calling it properly) and set the appropriate bits in the
wmTaskRecord.TaskMask.
To get snappy scrolling you will need to specify a content draw routine for
your window when you create the window and remember to only draw the material
that is necessary (i.e., dont redraw the whole window and let the system "clip
out" the material that is not visible {it will work but it may be too slow for
you}).
-----------------------------------------------------------------
Subj: Re:NDA Windows 89-11-04 18:32:51 EDT
From: WinkieJim
Thanks, I just got the toolbox vol 3 beta draft today and see that it would be
easy using TaskMasterDA...I wonder how it's done in the pre 5.0 days... (you
know the ancient times)
Thanks
Jim
-----------------------------------------------------------------
Subj: how to do NDA scroll bars before 5.0 89-11-07 01:56:12 EDT
From: Dave Lyons
Basically, nobody did. I saw one piece of sample code doing it, and it was
reasonably complicated: you had to create your own scroll bars, compute where
they were & leave that area out of the clip region when you redraw, and do your
own scroll-bar action procedure that calls your draw routine to redraw parts of
your content while the scrolling is happening.
TaskMasterDA is much more fun.
-----------------------------------------------------------------
Subj: huh? 90-04-05 22:07:56 EDT
From: Emmet2
I guess this means I should get vol 3 now?!?! I have the first two, but I am
as confused as it sounds like he was as to how to set up a scroll bar... and
all I want is a simple one that I know the amount of scroll before hand ... 50
line items, with maybe 5 visible at a time ... but it still seems like ...
nevermind you get the idea ...
-----------------------------------------------------------------
Type: Response
From: AFA Gary J
Date: 90-09-05 00:18:26 EST
Re: NDA Menus (moved messages)
Subj: NDA Menus 89-09-29 16:31:26 EDT
From: Crockett7 Msgs: 6 (89-10-15)
Im thinking of writing an NDA for System v5.0 using TML Pascal II, and would
like to know if there is a way to, once an NDA is opened, have the NDA insert a
Menu to the system menu bar and be able to process commands that were chosen
from the pull-down menu? I think the insertion could be done with the regular
commands InsertMenu(... but I am unsure how the NDA would get action commands
when the user selects an item. It can be done on the Mac [gasp!] but Im unsure
about the GS.
Thanks
Subj: Re: NDA Menus 89-10-02 22:31:27 EDT
From: JonahS
I think it could be done, but it probably shouldn't. Remember the Golden NDA
suideline: No NDA shall alter the system environment when it's not in control.
Think of AWGS, that is constantly changing the menus, ao PWG were the menus go
all the way across the screen. What whould happen then? I think it would be
safest not to try it. If the NDA needs a menu, you can put one in it's window.
Check out IIGS Tech Note #3 for info on that.
Jonah
Subj: Re: NDA Menus 89-10-04 00:05:38 EDT
From: JDavies1
Check out the Autumn issue of Call A.P.P.L.E. there is an article
by Tim Swihart that would be helpful. The article discusses the
two apple NDA and how it works. It's really interesting.
JD
Subj: Re: NDA Window Menus 89-10-09 23:05:57 EDT
From: JonahS
Yup, you can put menus in windows. You can either add them to an information
bar, if the window has a vertical scroll bar (see TN #3 for this) or you could
just do a _NewMenu on that window, etc., then _SetMenuBar to make it current. I
tried it a long time ago, and I think it worked....
Jonah
Subj: Re: NDA Window Menus 89-10-09 23:08:38 EDT
From: JonahS
Huh? Why did I say that? I'm not quite sure where that last post came from. I
think I fell asleep and my fingers typed it all by themselves. It has nothing
to do with anything. Geez. I think I'll go to bed and get some sleep. :(
Jonah
Subj: NDA's and the menu bar... 89-10-15 23:04:03 EDT
From: A2Pro Tim
I believe that Two Apples NDA will be about the only NDA ever to successfully
add a menu to the SYSTEM menu bar and have its contents work correctly! Why?
Because there is no way for the NDA to know when something has been selected
from a SYSTEM menu (Two Apples doesn't need to know - the system handles NDAs,
not Two Apples <grin>).
If you want to use menus from an NDA, then put the menus in your NDA's window
(either pull down menus in the Info bar or pop up menus some where in the
window...).
Tim S.
(yep, I'm the guy who wrote Two Apples) :-)
Type: Response
From: AFA Gary J
Date: 90-09-05 00:25:04 EST
Re: NDA Menu Events (moved messages)
Subj: NDA Menu Events 89-10-15 21:59:00 EDT
From: GGrant2 Msgs: 10 (89-10-31)
I'm writing an NDA, and I'm using the "MenuSelect" call for the window's menu
bar, which I'm supposed to use. However, the toolbox Ref. manual says that the
call returns the Menu/Item numbers in the Hi/Low words of the Long value WHEN
in the taskrec. WELL, this isn't true - when contains the tick count when the
even happened, just like it's NOT supposed to. What's the deal? Is this
something new to system 5.0, or has it always been this way?
GGrant2
Subj: Re: NDA Menu Events 89-10-16 23:07:37 EDT
From: JonahS
I thought that the Menu/Item numbers were supposed to be in the wmTaskData
field....
Jonah
Subj: But... 89-10-18 18:58:39 EDT
From: GGrant2
They would be, but I'm trying to get them from an NDA; I don't think you can
do it that way. does anyone know how to use the "TaskMasterDA" call, then?
GGrant2
Subj: Re: NDA Menu Events 89-10-21 02:22:47 EDT
From: JonahS
GGrant,
You could get the Toolbox Ref v3 from APDA, or I could post that one call....
Jonah
Subj: Re: NDA Menu Events 89-10-21 20:46:24 EDT
From: GGrant2
Wow, it would be great if you could post just how TaskMasterDA works, as it
would be really helpful for me...
GGrant2
Type: Response
From: AFA Gary J
Date: 90-09-05 00:26:28 EST
Re: NDA Menu Events (Moved Messages #2)
Subj: Menu item ID 89-10-25 23:16:14 EDT
From: SkySinger
As far as Jonah's remark that the Item number is in the wmTaskData field,
that seems to be true even though the docs say its in 'when' element of the
event record ('MenuSelect' pg 13-66 of volume 1 says its in the 'when' field).
I've gotten the ID from .wmTaskData even when the MainEventLoop of my program
was using GetNextEvent rather than TaskMaster (works OK since task rec is
defined as an event record).
The pseudo-code for TaskMaster pg 25-122 says the menu ID info is in
.wmTaskData field of TaskRec.
I haven't tried this with NDA items yet.
Subj: Ta da (at long last... :) 89-10-28 00:16:52 EDT
From: JonahS
Sorry this has taken me so long. I've been a bit busy:
Here's the form for the TaskMasterDA call:
TaskMasterDA $5F0E
Stack before call:
|____________|
|___Space____| Word - space for result
|_eventMask__| Word - Not used
|_taskRecPtr_| Long - Pointer to extended Task Record
| | <- SP
Stack after call:
|_Previous Contents_|
|______taskCode_____| Word - TaskMaster result code
| | <- SP
Errors: None
C: extern pascal Word TaskMasterDS(eventMask, taskRecPtr);
Pointer taskRecPtr;
Word eventMask;
Ta da! There you go. I hope this helps and isn't so late that it's of no use to
you.
Jonah
Subj: Remember.... 89-10-28 12:09:13 EDT
From: Coach101
The ToolBox Volume III manual is "moot" on this but the TaskRecord that you
pass to TaskMasterDA *must* be your own private TaskRecord. Copy the event
information that the DeskManager passed to you into you private TaskRecord and
then pass this private TaskRecord to TaskMasterDA.
Subj: Taskmaster and stuff. 89-10-30 22:51:11 EDT
From: JimMensch
The menu item information goes into wmTaskData like most everyone has now
figured out. As you also may have guessed, thats where its supposed to be, and
if toolbox ref volume 1 says it is in the when field, its wrong...
By the way, does the TaskmasterDA call mention that you should not only make
your own copy of the event into your own event record (thanks for pointing that
out coach) But also that you should also be using the new extended task record
instead of an old task record... Just thought I would throw another wrench into
your plans..
Mensch
Subj: TaskMasterDA --- Real Terse 89-10-31 00:28:04 EDT
From: Coach101
Jim, the description of TaskMasterDA in Volume III is so terse I might as well
type the whole thing in...
"This call is the TaskMaster entry point for desk accessories.
Your program passes event information obtained from the Desk
Manager."
However, in the stack diagram it does describe taskRecPtr as "Long--Pointer to
extended Task Record". So, yes, the description does mention the need for the
new Task Record though the mention is somewhat oblique.
Type: Response
From: AFA Gary J
Date: 90-09-05 02:13:33 EST
Re: NDA -- Runs only once ...? (moved)
(moved messages)
Subj: NDA -- Runs only once ... ? 90-06-06 17:25:49 EDT
From: Damien9 Msgs: 7 (90-06-08)
Would anyone know why an NDA would only execute the first time the user selects
it from the menu? I'm writing an NDA that has no window, and it works the
first time through, but after that, nothing ( and it doesn't crash the
machine...). I have a period of -1 (never call for events), and an event mask
of -1. Any help would be appreciated.
Thanks,
Jeff
P.S.
Coach, are there any folders on NDA development??
Subj: Is it possible 90-06-06 22:54:46 EDT
From: JonahS
that your code does something like checking to see if the window is already
open (so that it can bring it to the front when it's menu item is selected
again) and when you close the window, you forget to reset the flag?
Jonah
Subj: I Dont Remember The Details, but 90-06-07 00:08:33 EDT
From: Coach101
there is some magic about what you report back on an NDA open invocation. If
memory serves me correctly, you really want to tell the system you have a
window (in which case you had really better have a window). My problem is that
I can not remember what the restriction/game is; but, I do remember that there
is some constraint here.
Yes, there is a folder furhter down for NDA/CDA questions..
Greg Queen, (aka Coach, aka, Take-A-Lap)
Subj: NDA windows... 90-06-07 01:08:06 EDT
From: A2Pro Tim
Why not have an invisible window for your NDA? That lets you pass back a real
window, but not have one show up. Also, do _NOT_ just use an event mask of -1
unless you REALLY intend to do something intelligent with all events!!!! NDA's
that "eat" key down events, but don't do anything when keys get pressed, are a
MAJOR annoyment to real users!!!!! Eating Key down events PREVENTS things like
menu key equivalents from getting through to the application - meaning I can't
do OA-Q to quit from an app if the NDA that's the front window eats key presses.
If you're not doing anything with the event, don't grab it!!!! :-)
Tim S.
Subj: Only once... 90-06-07 19:11:26 EDT
From: Damien9
Thanks guys, I'll bet it's the invisible window trick...I vaguely remember
something about that. Tim, you're right about the event mask, but I couldn't
find my calculator so I used what's close....
Jeff
Subj: Don't need calculator for hex... 90-06-08 00:49:17 EDT
From: A2Pro Tim
There's a trick to converting binary to hex (the event mask bits will give you
binary). Just group the bits in sets of FOUR. Each set is ONE digit. Group
the resulting four digits to give you the hex equivalent of the bits and use
the hex value instead of a decimal value for your event mask - makes it easier
to figure out later also. :-)
Why does your NDA not need a window? Are you sure an NDA is the right thing to
do for the stuff you're doing? If it doesn't need a window, then I'd have to
ask myself if an NDA is what I want or if it should be an INIT or an app or...
Tim S.
Subj: Hex 'n' windows 90-06-08 19:42:23 EDT
From: Damien9
Tim,
It's just a silly little screen dump util. I just wanted to see if I could
write an NDA. It'd probably be better as a CDA, I'm going to do it both ways.
As for the calculator bit, I was being sarcastic, but we don't have a symbol
for that ... :)
Type: Response
From: JR Majka
Date: 91-08-29 19:34:07 EST
Re: NDA's & Print Manager
I am writing an NDA.
I am using PrDevOpen and PrDevWrite to send information to the printer, a
Hewlett-Packard LaserJet IIP.
With an application running, there is no problem. In the Finder, however, the
information never gets to the printer. I put in a tool error check. When the
NDA gets to PrDevOpen and PrDevWrite, I get an error #2. According to the
Print Manager error codes, a #2 is "portNotOn Specified port not selected in
the control panel."
That is incorrect. The printer port is specificied. Both the ROM control
panel and the NDA control panel show it to be selected and properly configured.
I have no problem using the printer with applications.
When I use the Harmonie port and printer drivers, I get the error and the
program continues. When I use Apple's printer port and Imagewriter II driver,
the system crashes.
I test for and start up the Font Manager, List Manager and Print Manager if
they are not loaded and started.
I also tried putting in PrValidate and PrDefault. They don't help.
Any suggestions?
Type: Response
From: Matt DTS
Date: 91-09-01 14:49:59 EST
Re: PrDev...
...calls are not designed to be called by applications, only by print drivers.
They go directly to the port drivers. Although I can't think of a reason why
it wouldn't work, it's not guaranteed to work and is definitely not supported.
Error $0002 is returned by the Tool Locator when that function can't be found,
which sounds like your code to start up the Print Manager isn't working. Try
using Nifty List and see if the Print Manager is started up when you think it
is. (Error $1302 is "port not on".)
If you just want to print text, you should use GS/OS calls and not use the
Print Manager. If you're not going to use the
OpenDoc/OpenPage/ClosePage/CloseDoc/PicFile loop, avoid the Print Manager
altogether. The only good exception I can think of is using PrDevAsyncWrite to
send PostScript to a chosen LaserWriter without using the LaserWriter driver.
--Matt
Type: Response
From: AFC SteveB
Date: 91-12-23 17:42:14 EST
Re: Getting 'em Menu Key equivs...
I'm on the process of writing an NDA that has a menu bar in it. What I would
like to do is be able to catch and handle keyboard equivs. of the menus.
Normally, I'd check for a KeyDown message from _TaskMasterDA, but my NDA has a
text edit control in it, so open apple - character keystrokes are treated like
events to the text edit control. Is there any easier way to catch menu key
equivs., short of setting up my own TextEdit filter procedure? WriteIt! v2.0
seems to do it some how...
Thanks!
Steve
Type: Response
From: Matt DTS
Date: 91-12-28 16:36:06 EST
Re: I'm missing something...
If you tell TaskMaster(DA) to handle menu keys, it should do this for you
automatically.
(Assuming, of course, that you set the current menu bar to your menu bar before
calling TaskMasterDA, as it can't possibly know enough to switch menu bars for
you.)
--Matt
Type: Response
From: AFC SteveB
Date: 91-12-28 16:41:09 EST
Re: Matt
I've done all that; _TaskMasterDA still thinks that it was a control hit. I'll
eximine it a little more and get back here.
Steve